import { createFromIconfontCN } from '@ant-design/icons';

/**
 * 自定义 IconFont 图标组件
 * 使用方法：<IconFont type="icon-xxx"  style className/>
 */

export const IconFont = createFromIconfontCN({
	scriptUrl: import.meta.env.VITE_ICONFONT_URL
});
// 然后创建组件
interface IconFontProps {
	type: string;
	className?: string;
	style?: React.CSSProperties;
}
export const IconFontLocal = (props: IconFontProps) => {
	const { type, className, style } = props;
	return (
		<svg className={`icon ${className}`} style={style} aria-hidden="true">
			<use xlinkHref={`#${type}`}></use>
		</svg>
	);
};

export default IconFont;
